#!/usr/bin/env python
# -*- coding: utf-8 -*-


def func1(x):
    return 3 * x + 2


# 测试数值计算
def test_numeric():
    n1 = 1 + 2      # 加: +
    n2 = n1 - 1     # 减: -
    n3 = n1 * n2    # 乘: *
    n4 = 1 / 2      # 除: /
    n5 = 1 // 2     # 取整: //
    n6 = 2 % 3      # 取余: %
    n7 = 2 ** 3     # 乘方: **
    print(n1, n2, n3, n4, n5, n6, n7)

    # 复杂的表达式
    n8 = (n1 + 2) * 2 - 6 / 3 + 7 % 2 ** 2
    print(n8)


# 测试变量类型变化
def test_numeric_type():
    n1 = 1 + 2
    print(type(n1))
    n1 = 1 / 2
    print(type(n1))


def main():
    y1 = func1(1)
    y2 = func1(2)
    print('y1=%d, y2=%d' % (y1, y2))

    test_numeric()
    test_numeric_type()


if __name__ == '__main__':
    main()
